package generic.gui.util;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JSeparator;

@SuppressWarnings("serial")
public class JMenuButtonForm extends JPanelForm {
	
	private JPanelForm panel;
	
	public JMenuButtonForm(int comprimento, int altura) {
		setLayout(null);
		setBounds(0, 0, comprimento, altura);
		setPanel(comprimento, altura);
		
		JSeparator separator = new JSeparator();
		separator.setBackground(new Color(110, 110, 110));
		separator.setBounds(0, altura - 7, comprimento, 30);
		
		add(getPanel());
		add(separator);
	}
	
	public void addSeparator(int posicao) {
		JSeparator separator = new JSeparator(JSeparator.VERTICAL);
		separator.setBackground(new Color(110, 110, 110));
		separator.setBounds(2 + posicao*75 + posicao*3, 8, 30, getBounds().height - 16 - 4);
		getPanel().add(separator);
	}

	public JPanelForm getPanel() {
		if (panel == null) {
			panel = new JPanelForm();	
			panel.setBackground(new Color(200, 200, 200));
		}
		return panel;
	}
	public void setPanel(int comprimento, int altura) {
		panel = new JPanelForm();
		panel.setLayout(null);
		panel.setBackground(new Color(200, 200, 200));
		panel.setBounds(0, 0, comprimento, altura - 4);
	}
	
	public void addMenus(Component component) {
		getPanel().add(component);
	}
}
